home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-23 | 3.9 KB | 135 lines | [TEXT/EDIT] |
- ; aInterp.txt 8:12:05 AM 2/11/87
- ; add Held 2:45:49 PM 5/31/87
- ; v 0.3 DA compatable 11:47:16 AM 1/21/88
- ; Mon Apr 25, 1988 15:12:04 macros
- ; Wed Apr 27, 1988 12:30:48 v 0.4
- ; Mon Jun 03, 1991 23:40:00 restructure
-
-
- TermBuf DCB.B 84,32 ; command line buffer
- IntA7: DC.L 0 ; initial value for A7
- Rzero: DC.L 0 ; value for A7 after linking
- UFlow: DC.L 0 ; room for stack underflow
- Szero: DC.L 0 ; bottom of stack
- Expand: DC.L 0 ; hold address of expand routine
- FreePt: DC.W dictend-Base ; initial compile point freespace
- FreeSz: DC.W 4096 ; initial headroom
- DictPt: DC.W task-theLink ; initial dict. search start
- NBase: DC.W 10 ; the numeric radix
- Held: DC.W 0 ; the HLD data
- DoesAddr: DC.L 0 ; "does>" jump address
- fcolon: DC.B 0 ; compile mode
- fimmed: DC.B 0 ; immediate flag
- fneg: DC.B 0 ; negative flag
- fint: DC.B $80 ; interactive mode
- fmacro: DC.W 0 ; macro flag+filler
-
- Cold: ; Set the Base pointer
- LEA Bottom,BP
- MOVE.L A1,Expand-Base(BP) ; a present from the application
-
- ; setup the interface
- JSR MacStart-base(BP) ; moved 6/3/91
-
- ; setup the stacks
- LEA IntA7-Base(BP),A0 ; A7 is already where it should be.
- MOVE.L A7,(A0)+ ; Save initial value of A7 at IntA7
- LINK PS,#-512 ; reserve 512 bytes for the stack
- MOVE.L RS,(A0)+ ; save return stack bottom at Rzero
- MOVE.L PS,(A0)+ ; Save under flow address at UFlow
- SUBQ.L #2,PS ; leave room for under flow
- MOVE.L PS,(A0) ; Put parameter stack bot. at Szero
-
- ; setup compile point register
- MOVE FreePt-Base(BP),D0 ; rel compile buffer pointer
- LEA 0(BP,D0.W),DP ; abs addr into DP register
-
- ; setup dictionary pointer register
- CLR.L Dict
- MOVE DictPt-base(BP),Dict ; rel.addr of the last dict. entry
-
- ; set the dictionary size
- MOVE freesz-base(BP),-(PS)
- JSR grow-base(BP)
-
- Warm: MOVEA.L Rzero-Base(BP),RS ; reset return stack
- MOVEA.L Szero-Base(BP),PS ; reset parameter stack
- JSR page-Base(BP) ; clear the page
- MOVE opener-base(BP),D0
- JSR 0(BP,D0) ; run the open routine 3/30/88
- CLR.L fcolon-base(BP)
- BSET.B #7,fint-base(BP)
- Restart:
- BSR.S GetInput
- Main: JSR token-Base(BP) ; get the next word
- MOVE Dict,-(PS) ; push pointer to last name
- JSR search-Base(BP) ; find current token in dictionary
- TST (PS)+ ; found NOT IF,
- BEQ.S TestNum ; ... assume its a number
- BCLR #7,fimmed-base(BP) ; ELSE, immediate? IF
- BNE.S GoDo ; ... do it
- TST.B fcolon-base(BP) ; ELSE, compiling? NOT IF,
- BEQ.S GoDo ; ... do it
- BCLR #7,fmacro-base(BP) ; ELSE, macro? IF
- BNE.S domc
- JSR Compile-base(BP) ; ELSE, compile a JSR to it
- BRA.S Main
- GoDo: JSR Execute-base(BP)
- JSR StkChk-base(BP)
- BRA.S Main
- domc: JSR mcomp-base(BP)
- BRA.S Main
-
- TestNum:
- JSR here-base(BP) ; get the relative address of token
- JSR Number-base(BP) ; convert it to a value, if posible
- TST (PS)+ ; was it?
- BNE.S @0 ; IF NOT,
- JMP WhaZat-base(BP) ; say huh??? and EXIT
- @0: TST.B fcolon-base(BP) ; THEN, are you compiling?
- BEQ.S Main ; IF NOT, leave it on the stack
- JSR Literal-base(BP) ; ELSE, compile it as a literal
- BRA.S Main ; THEN, get on with it
-
- GetInput:
- TST.B fint-base(BP)
- BEQ Pasting ; Get a line from scrap data
- TST.B fcolon-base(BP)
- BNE.S Line
- JSR Prompt-Base(BP)
- BRA.S Line
-
- Line: LEA termbuf-base(BP),IS ; set the input stream to termbuf
- MOVEQ #76,D0
- @0: MOVE.L #$20202020,0(IS,D0.W)
- SUBQ #4,D0
- BGE.S @0
- MOVE #termbuf-base,-(PS)
- MOVE #80,-(PS)
- JMP xpect-base(BP)
-
- DictStart:
- DCB.B 6,0 ; End of dictionary search
-
- DC.B 129,13,0,0 ; "{cr}" ( -- ) goto restart
- DC.W dictstart-base
- CRet: MOVE.L Rzero,RS ; reset return stack
- JMP Restart-base(BP) ; and jump
-
- DC.B 129,0,0,0 ; "{null}" ( -- ) same as cret
- DC.W cret-theLink
- NRet: BRA.S cret
-
- DC.B 9,'?TE' ; "?terminal" ( -- flag )
- DC.W nret-theLink ; was a key pressed?
- QTerm: JSR nextevent-base(BP)
- CLR -(PS)
- TST kflag-base(BP)
- BEQ.S @0
- SUBQ #1,(PS)
- @0: RTS
-
- DC.B 3,'KEY' ; "key" ( -- ascii )
- DC.W qterm-theLink ; wait for a key press
- Key: JMP keycode-base(BP)
-